$(function(){
	var head=localStorage.getItem("head");
	var name=localStorage.getItem("name");
	var identity=localStorage.getItem("identity");
	var signOut=localStorage.getItem("signOut");
	var navigation=$("#navigation div");
	navigation.empty();
	if(head&&signOut==0){
		navigation.append(
			"<img class='head' src="+head+">"+
			"<button class='btn btn-info'>"+name+"</button>"+
			"<button class='btn btn-info' onclick='signOut()'>"+"退出"+"</button>"
		);
		if(identity=="admin"){
			navigation.append("<button class='btn btn-info' onclick='amAdmin()'>"+"控制台"+"</button>")
		};
	}else{
		navigation.append(
			"<button id='logOn' class='btn btn-info'>"+"登录"+"</button>"+
			"<button id='register' class='btn btn-info'>"+"注册"+"</button>"
		);
	}
});

function signOut(){
	localStorage.setItem("signOut",1);
	window.location.href="http://localhost:3000";
}

$(function(){
	$("#movie").click(function(){
		window.location.href="http://localhost:3000/admin/movie";
	});
	$("#list").click(function(){
		window.location.href="http://localhost:3000/admin/list";
	});
})